package org.kabeja.dxf.entity;

import org.kabeja.dxf.DXFConstants;
import org.kabeja.dxf.helpers.HatchBoundaryLoop;
import org.kabeja.dxf.helpers.Point;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author shutao
 * @since 2022/4/24 17:43
 */
public class DXFHatch extends DXFEntity {
    private String name = "";
    private boolean solid = false;
    private int associativityFlag = 0;
    private int boundaryPathCount = 0;
    private int hatchStyle = 0;
    private int patternType = 0;
    private double patternAngle = 0.0D;
    private double patternScaleSpacing = 1.0D;
    private boolean boundaryAnnotation = false;
    private boolean patternDouble = false;
    private int definationLinesCount = 0;
    private double pixelSize = 0.0D;
    private int seedPointCount = 0;
    private double offsetVector = 0.0D;
    private int degenerateBoundaryPathCount = 0;
    private boolean gradientHatch = false;
    private Point elevationPoint = new Point();
    private List<HatchBoundaryLoop> boundaries = new ArrayList<>();
    private List<Object> patterns = new ArrayList<>();
    private String patternID = "";
    private double patternScale;
    private DXFHatchPattern hatchPattern;

    public DXFHatch() {
        this.setLineType(this.getType());
    }

    public void setHatchPattern(DXFHatchPattern dxfHatchPattern) {
        this.hatchPattern = dxfHatchPattern;
    }

    public DXFHatchPattern getHatchPattern() {
        return this.hatchPattern;
    }

    public int getAssociativityFlag() {
        return this.associativityFlag;
    }

    public void setAssociativityFlag(int var1) {
        this.associativityFlag = var1;
    }

    public boolean isBoundaryAnnotation() {
        return this.boundaryAnnotation;
    }

    public void setBoundaryAnnotation(boolean var1) {
        this.boundaryAnnotation = var1;
    }

    public int getBoundaryPathCount() {
        return this.boundaryPathCount;
    }

    public void setBoundaryPathCount(int var1) {
        this.boundaryPathCount = var1;
    }

    public int getDefinationLinesCount() {
        return this.definationLinesCount;
    }

    public void setDefinationLinesCount(int var1) {
        this.definationLinesCount = var1;
    }

    public int getDegenerateBoundaryPathCount() {
        return this.degenerateBoundaryPathCount;
    }

    public void setDegenerateBoundaryPathCount(int var1) {
        this.degenerateBoundaryPathCount = var1;
    }

    public boolean isGradientHatch() {
        return this.gradientHatch;
    }

    public void setGradientHatch(boolean var1) {
        this.gradientHatch = var1;
    }

    public int getHatchStyle() {
        return this.hatchStyle;
    }

    public void setHatchStyle(int var1) {
        this.hatchStyle = var1;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String var1) {
        this.name = var1;
    }

    public double getOffsetVector() {
        return this.offsetVector;
    }

    public void setOffsetVector(double var1) {
        this.offsetVector = var1;
    }

    public double getPatternAngle() {
        return this.patternAngle;
    }

    public void setPatternAngle(double var1) {
        this.patternAngle = var1;
    }

    public boolean isPatternDouble() {
        return this.patternDouble;
    }

    public void setPatternDouble(boolean var1) {
        this.patternDouble = var1;
    }

    public double getPatternScaleSpacing() {
        return this.patternScaleSpacing;
    }

    public void setPatternScaleSpacing(double var1) {
        this.patternScaleSpacing = var1;
    }

    public int getPatternType() {
        return this.patternType;
    }

    public void setPatternType(int var1) {
        this.patternType = var1;
    }

    public double getPixelSize() {
        return this.pixelSize;
    }

    public void setPixelSize(double var1) {
        this.pixelSize = var1;
    }

    public int getSeedPointCount() {
        return this.seedPointCount;
    }

    public void setSeedPointCount(int var1) {
        this.seedPointCount = var1;
    }

    public boolean isSolid() {
        return this.flags == 1;
    }

    public void setSolid(boolean var1) {
        this.solid = var1;
    }

    public void addBoundaryLoop(HatchBoundaryLoop var1) {
        this.boundaries.add(var1);
    }

    public Iterator<HatchBoundaryLoop> getBoundaryLoops() {
        return this.boundaries.iterator();
    }

    @Override
    public Bounds getBounds() {
        Bounds var1 = new Bounds();

        for (HatchBoundaryLoop boundary : this.boundaries) {
            Bounds var4 = boundary.getBounds();
            if (var4.isValid()) {
                var1.addToBounds(var4);
            }
        }

        return var1;
    }

    public Point getElevationPoint() {
        return this.elevationPoint;
    }

    public void setElevationPoint(Point var1) {
        this.elevationPoint = var1;
    }

    @Override
    public String getType() {
        return DXFConstants.ENTITY_TYPE_HATCH;
    }

    public String getDXFHatchPatternID() {
        return this.patternID;
    }

    public void setDXFHatchPatternID(String var1) {
        this.patternID = var1;
    }

    @Override
    public double getLength() {
        return 0.0D;
    }

    public double getPatternScale() {
        return this.patternScale;
    }

    public void setPatternScale(double var1) {
        this.patternScale = var1;
    }
}
